Micron Document
πŸŽ–οΈGitΠ―Ρ€Π°πŸŽ–οΈ


Displaying Rendered β€’ View raw β€’ Download

specs/20260711-153545-message-markdown-styling/data-model.md docs/obtainium-generated-deeplinks (42f311dd) Text, 3.37 KB

Phase 1 Data Model: Message Inline Markdown Styling

No persisted entities, no database migration, no protobuf changes. Markdown is parsed at render time and styled at display time; nothing is stored. This document defines only the in-memory types the parser and renderer pass around.

Coordinate systems

β€’ Raw text β€” the exact bytes the user typed / that arrived on the mesh, delimiters included (T383838"a **b** c"). This is what T383838TextFieldState.text holds and what T383838sendMessage transmits.
β€’ Display text β€” delimiters stripped, mentions substituted to display names (T383838"a b c"). All spans are expressed in display-space offsets.
β€’ The parser is responsible for producing the display string and the spans in one pass so offsets are internally consistent (research R3).

Types (in-memory, T383838commonMain, no Compose dependency)

T383838InlineStyle (enum)
The five inline styles, parity with iOS T383838MarkdownStyle.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Value β”‚ Delimiter(s) β”‚ Rendered as β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ T383838Bold β”‚ T383838** β”‚ T383838FontWeight.Bold β”‚
β”‚ T383838Italic β”‚ T383838* β”‚ T383838FontStyle.Italic β”‚
β”‚ T383838Strikethrough β”‚ T383838~~ β”‚ T383838TextDecoration.LineThrough β”‚
β”‚ T383838Code β”‚ BT383838 β”‚ T383838FontFamily.Monospace β”‚
β”‚ T383838Link β”‚ T383838LINK0 β”‚ T383838LinkAnnotation.Url (styled + tappable) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜


T383838StyleSpan
An inline style applied over a display-space range.
β€’ T383838range: IntRange β€” half-open in practice (T383838start until end), display-space.
β€’ T383838style: InlineStyle β€” one of the non-link styles (T383838Bold/T383838Italic/T383838Strikethrough/T383838Code). Multiple T383838StyleSpans may overlap (e.g. bold+italic).

T383838LinkSpan
A markdown link over a display-space range.
β€’ T383838range: IntRange β€” covers the link's display text (the label), display-space.
β€’ T383838url: String β€” the resolved destination.

T383838InlineMarkdownResult
The parser's return value β€” the single source of truth for a render.
β€’ T383838displayText: String β€” delimiter-stripped text (mentions already substituted by the caller before parsing, per R3).
β€’ T383838styleSpans: List<StyleSpan>
β€’ T383838linkSpans: List<LinkSpan>

β”‚ The renderer (T383838AutoLinkText) consumes T383838InlineMarkdownResult, then layers mention
β”‚ T383838LinkAnnotation.Clickable spans and URL/email/phone autolink spans over the same T383838displayText,
β”‚ using T383838usedIndices to prevent overlap with markdown links.

Authoring types (transient, T383838feature/messaging)

T383838FormattingResult
Return of each pure formatting helper (parity with iOS T383838FormattingResult).
β€’ T383838text: String β€” new raw text after the edit.
β€’ T383838selection: TextRange β€” new selection to apply to the T383838TextFieldState. T383838TextRange is a Compose Multiplatform T383838commonMain value type (no Android/desktop platform dependency); the helpers therefore stay T383838commonTest-runnable. A plain T383838IntRange/T383838Int pair is an acceptable framework-free substitute if preferred.

No other state is introduced. Toolbar visibility (T383838focus && text.length >= 3), the link-dialog URL string, and the pending link range are ordinary composable T383838remember/state, not model entities.

What is explicitly NOT added

β€’ No new column on the message entity, no T383838messagePayloadMarkdown-style stored/derived field (Android parses at render time, unlike iOS which persists a derived autolinked payload). Confirmed against T383838feature/messaging + T383838core/database.
β€’ No protobuf field; wire payload = raw T383838TextFieldState.text.
β€’ No new Room migration.

Served by rngit 1.5.0 - Generated in 0.06s